#条件变量 condition 难点
import threading
class XioaAi(threading.Thread):
    def __init__(self,lock):
        super().__init__(name='小爱')
        self.lock=lock

    def run(self):
        with self.lock:
            print(f'{self.name}: 在吗')

        with self.lock:
            print(f'{self.name}: 好啊')


class TianMao(threading.Thread):
    def __init__(self,lock):
        super().__init__(name='天猫精灵')
        self.lock=lock
    def run(self):
        with self.lock:
            print(f'{self.name}:在，小爱同学')

        with self.lock:
            print(f'{self.name}:我们来对古诗吧，小爱同学')


if __name__ == '__main__':
    lock=threading.Lock()
    xiaoai=XioaAi(lock)
    tianmao=TianMao(lock)
    tianmao.start()
    xiaoai.start()
